package com.ruoyi.common.core.enums;

/**
 * 操作步骤状态枚举
 * 
 * @author fkmalls
 */
public enum OptStepStatusEnum
{
    WAIT("wait", "待处理"),
    PROCESS("process", "处理中"),
    ERROR("error","处理失败"),
    SUCCESS("success","处理成功"),
    FINISH("finish", "已完成");

    private final String code;
    private final String name;

    OptStepStatusEnum(String code, String name)
    {
        this.code = code;
        this.name = name;
    }

    public String getCode()
    {
        return code;
    }

    public String getName()
    {
        return name;
    }

    public static String getNameByCode(String code) {
        for (OptStepStatusEnum item : OptStepStatusEnum.values()) {
            if (item.getCode().equals(code)) {
                return item.getName();
            }
        }
        return "";
    }

    public static String getCodeByName(String name) {
        for (OptStepStatusEnum item : OptStepStatusEnum.values()) {
            if (item.getName().equals(name)) {
                return item.code;
            }
        }
        return null;
    }
}
